<?php

namespace app\api\controller;

use app\api\service\SystemService;
use app\api\validate\CommonValidate;

class Common extends Base
{
    protected $middleware = ['NotFoundMiddleware'];

    /**
     * 生成短连接
     * @needLogin FALSE
     * @method GET
     * @return void
     */
    public function generateShortLink()
    {
        if (($msg = CommonValidate::generateShortLink($this->params)) !== true) apiReturn(201, $msg);
        list($code, $msg, $data) = SystemService::generateShortLink($this->params);
        apiReturn($code, $msg, $data);
    }
}